﻿using System;
using System.Reflection;
using System.Runtime.Serialization;

namespace SoldiHive.Core.Cache
{
	public sealed class CustomObjectBinder : SerializationBinder
	{
		public override Type BindToType(string assemblyName, string typeName)
		{
			Type typeToDeserialize = null;
			String currentAssembly = Assembly.GetExecutingAssembly().FullName;

			assemblyName = currentAssembly;

			typeToDeserialize = Type.GetType(String.Format("{0}, {1}",  typeName, assemblyName));

			return typeToDeserialize;
		}
	}
}